package pack3;

class Cylinder extends Shape {
    private double x;
    private double y;
    private double radius;
    private double height;

    public Cylinder(double x, double y, double radius, double height) {
        this.x = x;
        this.y = y;
        this.radius = radius;
        this.height = height;
        name = "Cylinder";
    }

    @Override
    public double calculateArea() {
        return 2 * Math.PI * radius * (radius + height);
    }

    @Override
    public double calculatePerimeter() {
        return 2 * Math.PI * radius;
    }

    @Override
    public void show() {
        System.out.println("圆柱体: 中心位置 [" + x + "," + y + "], radius = " + radius + ", height = " + height);
    }
}
